<?php
global $infopark;

drupal_add_css("misc/advert.css");
drupal_add_css("misc/jquery-ui-1.9.2.event.css");
// print render($page['header']);    
drupal_add_js("misc/advert.js");
//drupal_add_js("misc/front.js");
### Это для разделения цветов в левом боксе при разных категориях ###

if((arg(0)=='taxonomy')&&(arg(1)=='term'))
{
$term=taxonomy_term_load(arg(2));

}

if(
(arg(0)=='adverts') || (is_object($node)&&($node->type=='advert'))||(is_object($term)&&($term->vid==12))
)
{
$left_side_class='leftmenu_advert';
}else{
$left_side_class='leftmenu';
}



?>
<div class="wrapper">
    <div class="wrapmiddle"> 	  
            <?/*<div class="middle<?=(((arg(0)=='node')&&(arg(1)==57))|| (is_object($node)&&($node->type=='event')))?'_right':'';?>"> -- old*/?>
	    <div class="middle_right">
	     <div class="box_content">
	        <?
			##if EVENT ###
			/*if(((arg(0)=='node')&&(arg(1)==57))
			||(is_object($node)&&($node->type=='event'))):*/
			print _spec_event_search_engine();
			/*else:
			?>
	        <div class="search_box">
	        
	        <script>
	          (function() {
	            var cx = '003247387194311059579:rb_phtmff_8';
	            var gcse = document.createElement('script');
	            gcse.type = 'text/javascript';
	            gcse.async = true;
	            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
	                '//www.google.com/cse/cse.js?cx=' + cx;
	            var s = document.getElementsByTagName('script')[0];
	            s.parentNode.insertBefore(gcse, s);
	          })();
	        </script>
	        <gcse:searchbox></gcse:searchbox>
	        </div>
	        <div class="search_results_box">
	        <gcse:searchresults></gcse:searchresults>
	        </div>
                    <?php 
			endif;*/
			//print render($page['help']); 
                      
                        ?>
	        <!--content bof-->
	        
	        <div id='masonry'>
	        
	        	<? print render($page['content']);?>
	        
                    <?
                    #print template_footer();
                    ?>
                </div> 
               
	    
                <!--content eof-->
	        
	        </div>
	        <!-- /#container -->
                
	    </div>
	</div>
	    <div class="left"><div class="<?=$left_side_class;?>">
                        <!--MENU PANEL bof-->
	        	<?=(function_exists('advert_draw_city_menu'))?advert_draw_city_menu():'';?>
	        	<?=_draw_logo();?>
	        	<?=(function_exists('advert_draw_taxonomy_menu'))?advert_draw_taxonomy_menu():'';?>
	        	<!--MENU PANEL eof-->
	        </div>
	        <div class="filters">
                <?=back_btn();?>    
		<?
		if(
		((arg(0)=='node')&&(arg(1)==57))
		|| ((arg(0)=='node')&&(arg(1)==4435))
		|| ((arg(0)=='taxonomy')&&(arg(1)=='term')&&(arg(2)==69))
		||(arg(0)=='news')
		):
                
		?>
	        <?/*<div class="closepanel"><span onclick="close_filters()" class="filters_btn1">Свернуть</span></div>*/?>
                <?/*if((arg(0)=='node')&&(arg(1)==57)):?><script>close_filters();</script><?endif;*/?>
	        <?php
		endif;
			
                  if (!empty($tabs['#primary'])): ?>
                        <div class="tabs-wrapper clearfix"><?php print render($tabs); ?></div>
                  <?php endif;
	        	
	   #  </section> <!-- /#main -->
	        if((arg(0)=='taxonomy')&&(arg(1)=='term')):
	        	print advert_taxonomy_static_tree(arg(2));
	        endif;
	        
	        	### SHOW subcategory for adverts 
	        if(arg(0)=='adverts'):
	        	print advert_draw_sub_menu();
	        endif;
	       	if((arg(0)=='media-gallery')&&(arg(1)=='detail')):
	        	#echo back_btn();
                        echo _advert_compromise_gallery_photo_filter(arg(2));
	        	
	        endif;
	        	
	        if(((arg(0)=='taxonomy')&&(arg(1)=='term')&&(arg(2)=='69'))
	        	|| (arg(0)=='gallery_period')):
	        	#echo back_btn();
	        	echo _advert_compromise_gallery_ddmm_filter();
	        endif;
	        	#View FOr node info pane;#
				
	        if(is_object($node)&&(in_array($node->type,array('place','advert','event','media_gallery')))):
	        	//echo $node->type."<hr>";
	        	#echo back_btn();
			if($node->type=='event')echo template_draw_filter_title($node->title);	
	        	if($node->type=='media_gallery'):
	        	print _advert_compromise_gallery_filter($node->nid);
	        	endif;
	        	
	        	#if(is_object($node)&&($node->type=='advert')):
	        	if($node->type=='advert'):
	        	
	        	$node=_advert_get_node($node);
	        	foreach($node->public_dates as $d)
	        	  {
	        	  $dates[strtotime($d)]=$d;
	        	  }
	        	
	        	?>
	        <!--info PANEL bof-->
	        
	        <p>Добавлено:<?=date("d.m.Y",$node->created);?></p>
	        <?php if(($node->public_dates)&&$dates[max(array_keys($dates))]):?><p>Актуально до:<?=date("d.m.Y",strtotime($dates[max(array_keys($dates))]));?></p><?php endif;?>
	        <p>Просмотров:<?$statistics=statistics_get($node->nid);echo $statistics['totalcount'];##disabled on upload online=(statistics_get($node->nid)['totalcount']);?></p>
	        <p>ID обьявления:<?=$node->nid;?></p>
	        <?=_advert_draw_field_form($node);  ?>
	        <!--info PANEL eof-->
	        
	        	<?php endif;?>
				
	        	<?php endif;?>
	        	<?if((arg(0)=='news')||($node->type=='newarticle')):?>
                            <?#=back_btn();?>
                            <?=_advert_comp_news_archive_block();?>
                            <?=_advert_comp_reccomended_events_block();?>
	        	<?endif;?>
				<?
				### SETUP aboutusid FOR view submenu

#$aboutus_nid=21237;
#print draw_aboutus_menu($aboutus_nid);
				?>
	        	  <?php if ($page['sidebar_first']): ?>
	        	    <aside id="sidebar-first" role="complementary" class="sidebar clearfix">
                                
	        	      <?php print render($page['sidebar_first']); ?>
	        	    </aside>  <!-- /#sidebar-first -->
	        	  <?php endif; ?>
	        	<!--media banner--->
                          <div class="adlink" style="margin-top:24px;"><a href="/reklama-na-sayte">Реклама на сайте</a></div>
	        <div class="right_banner"><?php if ($page['navigation']):print render($page['navigation']);endif; ?>
                        <!--media banner end-->
	        	
	        </div>
	        
	        
	    </div>	
            <?/* if((!((arg(0)=='node')&&(arg(1)==57))) && (!(is_object($node)&&($node->type=='event')))) :?>
	    <div class="right">
             
	        <div class="adlink"><a href="/reklama-na-sayte">Реклама на сайте!</a></div>
                
                <div class="news_content">
	        
	        	    <!--aside id="sidebar-second" role="complementary" class="sidebar clearfix"-->
	        		<div class="right_banner">
					<!--flash static banner-->
					<!--object width="240" height="350"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
<param name="quality" value="high" /><param name="src" value="/themes/epimetheus/images/kakadu_240x350.swf" />
<embed type="application/x-shockwave-flash" width="240" height="350" src="/themes/epimetheus/images/kakadu_240x350.swf" quality="high">
</embed>
</object--><?php if ($page['navigation']): ?>
	        	      <?php print render($page['navigation']); ?>
			<?php endif; ?> 
                                        <h3>Слушай Онлайн</h3>
                                        <embed src="http://www.kissfm.ua/player_emb.swf" quality="high" width="240px" height="50px"  name="radioplayernewemb" align="middle" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
	        		  </div>
	        	    <!--/aside-->  <!-- /#sidebar-second -->
	        	  
	        <!--div class="right_banner">
	        	<a href="#"><img src="http://www.infopark.com.ua/sites/default/files/vip-kvartira.jpg"></a>
	        </div-->
	        <?
             
                if($_GET['q']=='node/4435')
                {
                echo $infopark->draw_tours();    
                }
              
                   //Last Added Events
	        echo spec_event_last_added();
            
	        if(arg(0)!='news'):
	        echo (function_exists('advert_news_widget'))?advert_news_widget():'';
                endif;
                ?>
	        <div class="fb-like-box" data-href="https://www.facebook.com/infopark.com.ua" data-width="240" data-height="325" data-show-faces="true" data-stream="false" data-show-border="false" data-header="false"></div>
	        
	        <script type="text/javascript" src="http://userapi.com/js/api/openapi.js?52"></script>
	        
	        		<!-- VK Widget -->
	        		<div id="vk_groups"></div>
	        		<script type="text/javascript">
	        		VK.Widgets.Group("vk_groups", {mode: 0, width: "240", height: "290"}, 41530940);
	        		</script>
	        <br><br><br><br><br><br><?php print render($page['footer']) ?>
	        </div>
	        
	        
	    </div> 
	        <?endif;*/?>
</div>


<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter21940810 = new Ya.Metrika({id:21940810,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true});
        } catch(e) { }
    });

    var n = d.getElementsByTagName("script")[0],
        s = d.createElement("script"),
        f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

    if (w.opera == "[object Opera]") {
        d.addEventListener("DOMContentLoaded", f, false);
    } else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/21940810" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->